package com.ffs.game.scene;

import java.util.HashMap;
import java.util.Map;

/**
 * 场景管理
 *
 * @author ffs80
 */
public class SceneManager {

    private static final SceneManager INSTANCE = new SceneManager();

    private Map<Integer, GameScene> sceneMap = new HashMap<>();

    public static SceneManager getInstance() {
        return INSTANCE;
    }

    public void addScene(GameScene gameScene) {
        sceneMap.put(gameScene.getSceneId(), gameScene);
        gameScene.initDriver();
    }

    public void remove(int sceneId) {
        GameScene gameScene = sceneMap.remove(sceneId);
        gameScene.stopTimer();

    }

    public GameScene findScene(int sceneId) {
        return sceneMap.get(sceneId);
    }
}
